<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>流程明细</title>
    <#include "/pubHeadStyle.html">
</head>
<body>
<div class="layui-tab layui-tab-card" lay-filter="commonDetail" style="height: 100%">
    <ul class="layui-tab-title">
        <li class="layui-this" lay-id="detail">运行明细</li>
        <li lay-id="flowVarsAndValue">流程变量</li>
        <li lay-id="bpmImage" id="flowChart">流程图</li>
        <li lay-id="opinion">审批历史</li>
        <li lay-id="getForm">业务表单</li>
        <#if processRun.status==2>
            <li lay-id="copyTo">抄送人</li>
        </#if>
    </ul>
    <div class="layui-tab-content" style="height: 90%">
        <div class="layui-tab-item layui-show" style="height: 100%">
            <iframe id="detailDiv" style="overflow-y: auto;width: 100%; height: 100%; border: none;" src=""></iframe>
        </div>
    </div>
</div>

<script>
    layui.config({
        base: serverPath.systemPath + staticPath.systemPath //静态资源所在路径
    }).extend({
        index: 'index' //主入口模块
    }).use(['index','setter', 'element'], function () {
        var setter = layui.setter;
        var $ = layui.$;
        var element = layui.element;
        var runId = "${runId!}";
        var procInstId = "${procInstId}";

        var detailUrl = serverPath.workflowPath+setter.workflowLinkPath+"processRun/view/detail?runId=" + runId;
        var flowVarsAndValueUrl = serverPath.workflowPath+setter.workflowLinkPath+"processRun/view/flowVarsAndValue?runId=" + runId;
        var getFormUrl = serverPath.workflowPath+setter.workflowLinkPath+"processRun/view/getForm?runId=" + runId;
        var opinionUrl = serverPath.workflowPath+setter.workflowLinkPath+"taskOpinion/view/list?runId=" + runId;
        var bpmImageUrl = serverPath.workflowPath+setter.workflowLinkPath+"processRun/view/bpmImg?procInstId="+procInstId+"&runId="+runId;
        var copyToUrl = serverPath.workflowPath+setter.workflowLinkPath+"processCopyTo/view/getList?runId="+runId;

        function changeLoad(url) {
            $("#detailDiv").attr('src',url);
        }

        changeLoad(detailUrl);
        element.on('tab(commonDetail)', function () {
            var layId = this.getAttribute('lay-id');
            switch (layId) {
                case "detail":
                    changeLoad(detailUrl);
                    $(".qtip").hide();
                    break;
                case "flowVarsAndValue":
                    changeLoad(flowVarsAndValueUrl);
                    $(".qtip").hide();
                    break;
                case "opinion":
                    changeLoad(opinionUrl);
                    $(".qtip").hide();
                    break;
                case "getForm":
                    changeLoad(getFormUrl);
                    $(".qtip").hide();
                    break;
                case "bpmImage":
                    changeLoad(bpmImageUrl);
                    $(".qtip").hide();
                    break;
                case"copyTo":
                    changeLoad(copyToUrl);
                    $(".qtip").hide();
                    break;
            }
        });

        // 点击授权人员弹窗
        authUserClick = function (ownerId) {
            layer.open({
                type: 2,
                title: '人员详细信息',
                area: ['600px', '500px'],
                shadeClose: true,
                content:serverPath.systemPath+ setter.sysLinkPath+ 'sysUser/view/view?userId=' + ownerId
            });
        };
    });
</script>
</body>
</html>